package com.ruoyi.draw.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.draw.mapper.NovelRoleMapper;
import com.ruoyi.draw.domain.NovelRole;
import com.ruoyi.draw.service.INovelRoleService;

/**
 * NovelRoleService业务层处理
 * 
 * @author Locke
 * @date 2025-10-25
 */
@Service
public class NovelRoleServiceImpl implements INovelRoleService 
{
    @Autowired
    private NovelRoleMapper novelRoleMapper;

    /**
     * 查询NovelRole
     * 
     * @param id NovelRole主键
     * @return NovelRole
     */
    @Override
    public NovelRole selectNovelRoleById(Long id)
    {
        return novelRoleMapper.selectNovelRoleById(id);
    }

    /**
     * 查询NovelRole列表
     * 
     * @param novelRole NovelRole
     * @return NovelRole
     */
    @Override
    public List<NovelRole> selectNovelRoleList(NovelRole novelRole)
    {
        return novelRoleMapper.selectNovelRoleList(novelRole);
    }

    /**
     * 新增NovelRole
     * 
     * @param novelRole NovelRole
     * @return 结果
     */
    @Override
    public int insertNovelRole(NovelRole novelRole)
    {
        novelRole.setId(System.currentTimeMillis());
        novelRole.setUpdateBy(SecurityUtils.getUsername());
        novelRole.setCreateTime(DateUtils.getNowDate());
        return novelRoleMapper.insertNovelRole(novelRole);
    }

    /**
     * 修改NovelRole
     * 
     * @param novelRole NovelRole
     * @return 结果
     */
    @Override
    public int updateNovelRole(NovelRole novelRole)
    {
        novelRole.setUpdateBy(SecurityUtils.getUsername());
        novelRole.setUpdateTime(DateUtils.getNowDate());
        return novelRoleMapper.updateNovelRole(novelRole);
    }

    /**
     * 批量删除NovelRole
     * 
     * @param ids 需要删除的NovelRole主键
     * @return 结果
     */
    @Override
    public int deleteNovelRoleByIds(Long[] ids)
    {
        return novelRoleMapper.deleteNovelRoleByIds(ids);
    }

    /**
     * 删除NovelRole信息
     * 
     * @param id NovelRole主键
     * @return 结果
     */
    @Override
    public int deleteNovelRoleById(Long id)
    {
        return novelRoleMapper.deleteNovelRoleById(id);
    }
}
